<?php 
	$pPageIsPublic = false;
	include '../_common.php';
	$_SESSION["m1"]="destination";
	$_SESSION["m2"]="divingstyle-list";
?>
<?php include("header.php"); ?>
<?php
$tabs 	= array('banners' => 1);
$selTab = $tabs[$_REQUEST['tab']] ? $tabs[$_REQUEST['tab']] : 0;
?>

<script type="text/javascript">
Shadowbox.init();  
$().ready(function(){
	$('#content-tabs').tabs({
		initial  : <?php echo $selTab ?>
	});
	
	$('ul#listin').admin_sortable("DivingStyle");
	$('ul#listin-banner').admin_sortable("ds-banner");

	
	$('#select-all').checkedToggle('ul#listin');
	
	$('#del').live('click', function(){
		var check = $(this).closest("li").find('input:checkbox');  
		check.attr('checked', true);
		delItemSelected(check);
	});
});

function delItemSelected(btn) {
	var checked = $('ul#listin').find('input:checked');
	
	if (checked.length == 0) {
		Notify('Select a Item.!',1);
		return false;
	} else {
		var items, li;
		if (btn.id == "checked") {
			items = checked.serialize();
			li = checked.closest("li");
		} else {
			items = $(btn).serialize();
			li = $(btn).closest("li");
		}
		
		items = decodeURIComponent(items);
		
		if (! confirm("You going to delete "+ li.length +" items ?")){
			return false;
		} else {
			ajaxAdmin({
				data: items + "&action=item-delete&class=divingstyle",
				success: function(response) {
					if (response) {
						Notify(response, 0);
						li.fadeOut(300, function(){$(this).remove();});
					}	
				}
			});
		}					
	}
}
</script>
<?php include("sidebar.php"); ?>
<div id="list">
<h2>Diving Style List</h2>
 <div id="content-tabs">
		<ul>
			<li><a href="#fragment-1"><span>Diving Style List</span></a></li>
			<li><a href="#fragment-2"><span>Order Banner</span></a></li>
		</ul>
		<div id="fragment-1" >
<ul id="subnav">
 	<li class="noleft"><input type="checkbox" name="select-all" id="select-all" /><label for="select-all" class="first-check" >Select All</label></li>
	<li ><a href="javascript:void(0);" id="checked" onclick="delItemSelected(this)"  >Delete Selection</a></li>
	<li class="noborder" > <a href="divingstyle-add.php" class="add"> Add a New Diving Style </a></li>
</ul>
<table id="gradient-style" >
	<thead>
		<tr>
    		<th width="85%" >Diving Style</th>
    		<th width="15%" >Action</th>
  		</tr>
	</thead>
</table>
<ul id="listin" >
<?php
$objDs = new DivingStyle();
$objDs ->loadItems(null, "#status like '".$chkstatus."%'");
while($objItem = $objDs ->rNext()):
?>	
	<li id="recordsArray_<?php echo $objItem->id; ?>"><table id="gradient-style">
		<tr>
			<td width="4%" ><input type="checkbox" name="items[]" value="<?php echo $objItem->id;?>" /></td>
    		<td width="81%"  ><strong><?php echo $objItem ->title  ?></strong><br/>
	    		<strong class="note-small" >status: </strong><?php echo $objItem ->status  ?><br/>
    		</td>
    		<td width="15%" >
    			<table>
				  <tr>
				    <td>
				    	<p class="subnav">
	    					<a href="divingstyle-add.php?id=<?php echo $objItem ->id ?>" > edit  </a>
	    					<a href="javascript:void(0)" id="del" > delete  </a>
	    				</p>
				    </td>
				  </tr>
				</table>    		
    		</td>
  		</tr></table>
  	</li>
<?php endwhile;  ?>  		
</ul>
</div>


<div id="fragment-2" >
<?php
$objDs = new DivingStyle();
$objDs ->loadItems('#bannerId ASC');
	if($objDs ->rCount()) { aya?>
<a href="<?= $_SERVER['PHP_SELF']."?tab=banners" ?>">refresh</a>	
<table id="gradient-style" >
	<thead>
		<tr>
    		<th width="99%" >Name</th>
  		</tr>
	</thead>
</table>
<style>
#gradient-style a.ax:hover { border:0; background-color: transparent; }
li.active {background-color:#FCFADB;}
li.active #gradient-style tbody tr:hover td {background-color: #FCFADB;} 
</style>
<ul id="listin-banner" style="list-style: none;" >
<?php
$i = 0;
		while($objItem = $objDs ->rNext()){
			 if (!strlen($objItem ->bnImage)) continue;  
			 $i++;
?>
		
	<li id="recordsArray_<?php echo $objItem->id; ?>" class="<?= ($i < 6 ? "active" : "") ?>" ><table id="gradient-style"  >
		<tr>
    		<td width="99%"  ><strong><?php echo $objItem ->title  ?></strong><br/>
    			<a class="ax" href="../upload/<?= $objItem ->bnImage ?>" rel="shadowbox[files]">
    				<img alt="" src="../thumb.php?src=../upload/<?= $objItem ->bnImage ?>&w=290&h=60" width="290" height="60"  />
    			</a>
    		</td>
  		</tr></table>
  	</li>		
<?php 			
		} 
?>
</ul>
<?php 		
	} 
?>

</div>


</div>
</div>
<div class="clear"></div>    
<?php include("footer.php"); ?>